import os

from PIL import Image, ImageDraw, ImageFont

cover = Image.new('RGB', (1200, 1600), (230, 241, 245))
pen = ImageDraw.Draw(cover)
pen.rectangle([0, 0, 100, 1600], (170, 180, 182))
pen.rectangle([100, 100, 1200, 380], (170, 180, 182))
font = ImageFont.truetype(os.path.join("fonts",'simsun.ttc'), 120)
title = '羞羞的铁拳羞羞的铁拳羞羞的铁拳羞羞的铁拳羞羞的铁拳'
size = pen.textsize(title,font=font)
print(size)
pen.multiline_text((130, 100), title, fill=(
    0, 0, 0), font=font, align='center')
del pen
cover.save('cover_test.jpeg', 'JPEG')
